﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;

namespace CitiSurface
{
    /*
     * Used to select datatemplate for different MainBarItem
     */
    public class MainBarDataTemplateSelector : DataTemplateSelector
    {
        public DataTemplate ImageTemplate { get; set; }

        public DataTemplate VideoTemplate { get; set; }

        public DataTemplate DocTemplate { get; set; }

        public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
        {
            var element = container as FrameworkElement;

            // select DataTemplate by Item type
            if(element != null)
            {
                if (item is MainBarAlbum)
                {
                    return ImageTemplate;
                }
                if(item is MainBarVideo)
                {
                    return VideoTemplate;
                }
                if(item is  MainBarDoc)
                {
                    return DocTemplate;
                }
            }
            return null;
        }
    }
}
